function getClass(parent,aE){
	var arr=[];
	var aResult=parent.getElementsByTagName('*');
	for(var i=0;i<aResult.length;i++){
		var Arr=aResult[i].className.split(' ');
		for(var j=0;j<Arr.length;j++){
			if(Arr[j]==aE){
			arr.push(aResult[i]);
			}
		}
		
	}
	return arr;
}
var oWrap=document.getElementById('wrap');
var oCarous=document.getElementById('carous');
var oImg=oCarous.getElementsByTagName('img');
var oCarL=document.getElementById('car-left');
var oCarR=document.getElementById('car-right');
var oCarUl=document.getElementById('carUl');
var oCarLi=oCarUl.getElementsByTagName('li');
var newnum=0;
function autoPlay(){
	newnum++;
	if(newnum>oImg.length-1){
		newnum=0;
	}
	tab();
}
var Cartimer=setInterval(autoPlay,4000);
function tab(){
	for(j=0;j<oImg.length;j++){
		oImg[j].style.opacity=0;
		oCarLi[j].className='';
	}
	oCarLi[newnum].className='active';
	startmove(oImg[newnum],{opacity:100});
}
oWrap.onmouseover=function(){
	clearInterval(Cartimer);
}
oWrap.onmouseout=function(){
	Cartimer=setInterval(autoPlay,3000);
}
oCarUl.onmouseover=function(){
	clearInterval(Cartimer);
}
oCarUl.onmouseout=function(){
	Cartimer=setInterval(autoPlay,3000);
}
for(i=0;i<oCarLi.length;i++){
	oCarLi[i].index=i;
	oCarLi[i].onclick=function(){
		newnum=this.index;
		tab();
	}
}
oCarL.onclick=function(){
	newnum--;
	if(newnum<0){
		newnum=oImg.length-1;
	}
	tab();
}
oCarR.onclick=function(){
	newnum++;
	if(newnum>oImg.length-1){
		newnum=0;
	}
	tab();
}

var oProduct=document.getElementById('productCar');
var oShopcar=document.getElementById('product-shopCar');
var oWid=document.getElementById('wid');
var omoveUl=document.getElementById('moveul');
var oLi=omoveUl.getElementsByTagName('li');
var oBtnLeft=document.getElementById('left');
var oBtnRight=document.getElementById('right');
for(var i=0;i<oLi.length;i++){
	oLi[i].style.width=parseFloat(oWid.offsetWidth)/4+'px';
}
var num=0;
omoveUl.innerHTML+=omoveUl.innerHTML+omoveUl.innerHTML;
omoveUl.style.width=oLi[0].offsetWidth * oLi.length +'px';
var left=parseInt((omoveUl.offsetWidth)/3);
oBtnLeft.onclick=function(){
	num--;
	if(num<0){
		num=2;
	}
	startmove(omoveUl,{left:-left*num});
	
}
oBtnRight.onclick=function(){
	num++;
	if(num>2){
		num=0;
	}
	startmove(omoveUl,{left:-left*num});
}
function move(){
	num++;
	if(num>2){
		num=0;
	}
	startmove(omoveUl,{left:-left*num});
}
var timer=setInterval(move,3000);
oProduct.onmouseover=function(){
	clearInterval(timer);
}
oProduct.onmouseout=function(){
	timer=setInterval(move,3000);
}